package normalisation;

import java.util.ArrayList;

public class NgrammeTokenizer {

    private int n;

    public NgrammeTokenizer(int nGramme) {
        n = nGramme;
    }

    public ArrayList<String> tokenize(String text) {
        ArrayList<String> result = new ArrayList<String>();
        if (text.length() > n) {
            for (int i = 0; i < text.length() - n + 1; i++) {
                result.add(text.substring(i, i + n));
            }
        } else {
            result.add(text);
        }

        return result;
    }
}
